-- Decompiled with the Synapse X Luau decompiler.

local l__CommonOHOH__1 = _G.CommonOHOH;
local v2 = l__CommonOHOH__1.load.OHOHConnection();
local v3 = {
	FallingDown = Enum.HumanoidStateType.FallingDown, 
	Running = Enum.HumanoidStateType.Running, 
	RunningNoPhysics = Enum.HumanoidStateType.RunningNoPhysics, 
	Climbing = Enum.HumanoidStateType.Climbing, 
	StrafingNoPhysics = Enum.HumanoidStateType.StrafingNoPhysics, 
	Ragdoll = Enum.HumanoidStateType.Ragdoll, 
	GettingUp = Enum.HumanoidStateType.GettingUp, 
	Jumping = Enum.HumanoidStateType.Jumping, 
	Landed = Enum.HumanoidStateType.Landed, 
	Flying = Enum.HumanoidStateType.Flying, 
	Freefall = Enum.HumanoidStateType.Freefall, 
	Seated = Enum.HumanoidStateType.Seated, 
	PlatformStanding = Enum.HumanoidStateType.PlatformStanding, 
	Dead = Enum.HumanoidStateType.Dead, 
	Swimming = Enum.HumanoidStateType.Swimming, 
	Physics = Enum.HumanoidStateType.Physics, 
	None = Enum.HumanoidStateType.None
};
local u1 =nil
 u1 ={
	Init = function(p1)
		if not p1.parent.main_inst.Parent then
			p1.parent:AddHandleOnInWorkspace(function()
				u1.Init(p1);
			end, true);
			return;
		end;
		u1.GetParts(p1);
		u1.GetAttachments(p1);
		u1.CreateNoCollisions(p1);
		u1.CreateConstraints(p1);
		u1.GetMotors(p1);
	end, 
	GetMotors = function(p2)
		local l__parts__4 = p2.parts;
		local v5 = {};
		p2.modelMotos = v5;
		v5.LeftAnkle = l__parts__4.LeftFoot.LeftAnkle;
		v5.LeftWrist = l__parts__4.LeftHand.LeftWrist;
		v5.LeftElbow = l__parts__4.LeftLowerArm.LeftElbow;
		v5.LeftKnee = l__parts__4.LeftLowerLeg.LeftKnee;
		v5.LeftShoulder = l__parts__4.LeftUpperArm.LeftShoulder;
		v5.LeftHip = l__parts__4.LeftUpperLeg.LeftHip;
		v5.Root = l__parts__4.LowerTorso.Root;
		v5.RightAnkle = l__parts__4.RightFoot.RightAnkle;
		v5.RightWrist = l__parts__4.RightHand.RightWrist;
		v5.RightElbow = l__parts__4.RightLowerArm.RightElbow;
		v5.RightKnee = l__parts__4.RightLowerLeg.RightKnee;
		v5.RightShoulder = l__parts__4.RightUpperArm.RightShoulder;
		v5.RightHip = l__parts__4.RightUpperLeg.RightHip;
		v5.Waist = l__parts__4.UpperTorso.Waist;
		v5.Neck = l__parts__4.Head.Neck;
	end
};
function u1.GetAttachments(p3)
	local v6 = {};
	local l__parts__7 = p3.parts;
	p3.attachs = v6;
	v6.Head_Neck = l__CommonOHOH__1:GetPath("NeckRigAttachment", l__parts__7.Head);
	v6.UpperTorso_Neck = l__CommonOHOH__1:GetPath("NeckRigAttachment", l__parts__7.UpperTorso);
	v6.UpperTorso_RightShoulder = l__CommonOHOH__1:GetPath("RightShoulderRigAttachment", l__parts__7.UpperTorso);
	v6.RightUpperArm_RightShoulder = l__CommonOHOH__1:GetPath("RightShoulderRigAttachment", l__parts__7.RightUpperArm);
	v6.UpperTorso_LeftShoulder = l__CommonOHOH__1:GetPath("LeftShoulderRigAttachment", l__parts__7.UpperTorso);
	v6.LeftUpperArm_LeftShoulder = l__CommonOHOH__1:GetPath("LeftShoulderRigAttachment", l__parts__7.LeftUpperArm);
	v6.UpperTorso_Waist = l__CommonOHOH__1:GetPath("WaistRigAttachment", l__parts__7.UpperTorso);
	v6.LowerTorso_Waist = l__CommonOHOH__1:GetPath("WaistRigAttachment", l__parts__7.LowerTorso);
	v6.RightUpperArm_RightElbow = l__CommonOHOH__1:GetPath("RightElbowRigAttachment", l__parts__7.RightUpperArm);
	v6.RightLowerArm_RightElbow = l__CommonOHOH__1:GetPath("RightElbowRigAttachment", l__parts__7.RightLowerArm);
	v6.LeftUpperArm_LeftElbow = l__CommonOHOH__1:GetPath("LeftElbowRigAttachment", l__parts__7.LeftUpperArm);
	v6.LeftLowerArm_LeftElbow = l__CommonOHOH__1:GetPath("LeftElbowRigAttachment", l__parts__7.LeftLowerArm);
	v6.RightLowerArm_RightWrist = l__CommonOHOH__1:GetPath("RightWristRigAttachment", l__parts__7.RightLowerArm);
	v6.RightHand_RightWrist = l__CommonOHOH__1:GetPath("RightWristRigAttachment", l__parts__7.RightHand);
	v6.LeftLowerArm_LeftWrist = l__CommonOHOH__1:GetPath("LeftWristRigAttachment", l__parts__7.LeftLowerArm);
	v6.LeftHand_LeftWrist = l__CommonOHOH__1:GetPath("LeftWristRigAttachment", l__parts__7.LeftHand);
	v6.LowerTorso_RightHip = l__CommonOHOH__1:GetPath("RightHipRigAttachment", l__parts__7.LowerTorso);
	v6.RightUpperLeg_RightHip = l__CommonOHOH__1:GetPath("RightHipRigAttachment", l__parts__7.RightUpperLeg);
	v6.LowerTorso_LeftHip = l__CommonOHOH__1:GetPath("LeftHipRigAttachment", l__parts__7.LowerTorso);
	v6.LeftUpperLeg_LeftHip = l__CommonOHOH__1:GetPath("LeftHipRigAttachment", l__parts__7.LeftUpperLeg);
	v6.RightUpperLeg_RightKnee = l__CommonOHOH__1:GetPath("RightKneeRigAttachment", l__parts__7.RightUpperLeg);
	v6.RightLowerLeg_RightKnee = l__CommonOHOH__1:GetPath("RightKneeRigAttachment", l__parts__7.RightLowerLeg);
	v6.LeftUpperLeg_LeftKnee = l__CommonOHOH__1:GetPath("LeftKneeRigAttachment", l__parts__7.LeftUpperLeg);
	v6.LeftLowerLeg_LeftKnee = l__CommonOHOH__1:GetPath("LeftKneeRigAttachment", l__parts__7.LeftLowerLeg);
	v6.RightLowerLeg_RightAnkle = l__CommonOHOH__1:GetPath("RightAnkleRigAttachment", l__parts__7.RightLowerLeg);
	v6.RightFoot_RightAnkle = l__CommonOHOH__1:GetPath("RightAnkleRigAttachment", l__parts__7.RightFoot);
	v6.LeftLowerLeg_LeftAnkle = l__CommonOHOH__1:GetPath("LeftAnkleRigAttachment", l__parts__7.LeftLowerLeg);
	v6.LeftFoot_LeftAnkle = l__CommonOHOH__1:GetPath("LeftAnkleRigAttachment", l__parts__7.LeftFoot);
end;
local l__Instance__2 = Instance;
local l__pairs__3 = pairs;
function u1.CreateConstraints(p4)
	local l__parts__8 = p4.parts;
	local l__attachs__9 = p4.attachs;
	local v10 = {};
	p4.constraints = v10;
	local v11 = l__Instance__2.new("Folder", p4.parent.main_inst);
	v11.Name = "Constraints";
	p4.constraints_folder = v11;
	local v12 = l__Instance__2.new("BallSocketConstraint", v11);
	v10.NeckConstraint = v12;
	v12.Name = "NeckConstraint";
	v12.LimitsEnabled = true;
	v12.TwistLimitsEnabled = true;
	v12.UpperAngle = 60;
	v12.TwistLowerAngle = -75;
	v12.TwistUpperAngle = 65;
	v12.Attachment1 = l__attachs__9.Head_Neck;
	v12.Attachment0 = l__attachs__9.UpperTorso_Neck;
	local v13 = l__Instance__2.new("BallSocketConstraint", v11);
	v10.WaistConstraint = v13;
	v13.Name = "WaistConstraint";
	v13.LimitsEnabled = true;
	v13.TwistLimitsEnabled = true;
	v13.UpperAngle = 30;
	v13.TwistLowerAngle = -55;
	v13.TwistUpperAngle = 25;
	v13.Attachment0 = l__attachs__9.LowerTorso_Waist;
	v13.Attachment1 = l__attachs__9.UpperTorso_Waist;
	local v14 = l__Instance__2.new("BallSocketConstraint", v11);
	v10.RightShoulderConstraint = v14;
	v14.Name = "RightShoulderConstraint";
	v14.LimitsEnabled = true;
	v14.TwistLimitsEnabled = true;
	v14.UpperAngle = 45;
	v14.TwistLowerAngle = -90;
	v14.TwistUpperAngle = 150;
	v14.Attachment0 = l__attachs__9.UpperTorso_RightShoulder;
	v14.Attachment1 = l__attachs__9.RightUpperArm_RightShoulder;
	local v15 = l__Instance__2.new("BallSocketConstraint", v11);
	v10.LeftShoulderConstraint = v15;
	v15.Name = "LeftShouldderConstraint";
	v15.LimitsEnabled = true;
	v15.TwistLimitsEnabled = true;
	v15.UpperAngle = 45;
	v15.TwistLowerAngle = -90;
	v15.TwistUpperAngle = 150;
	v15.Attachment0 = l__attachs__9.UpperTorso_LeftShoulder;
	v15.Attachment1 = l__attachs__9.LeftUpperArm_LeftShoulder;
	local v16 = l__Instance__2.new("HingeConstraint", v11);
	v10.RightElbowConstraint = v16;
	v16.Name = "RightElbowConstraint";
	v16.LimitsEnabled = true;
	v16.UpperAngle = 135;
	v16.LowerAngle = 0;
	v16.Restitution = 0;
	v16.Attachment0 = l__attachs__9.RightUpperArm_RightElbow;
	v16.Attachment1 = l__attachs__9.RightLowerArm_RightElbow;
	local v17 = l__Instance__2.new("HingeConstraint", v11);
	v10.LeftElbowConstraint = v17;
	v17.Name = "LeftElbowConstraint";
	v17.LimitsEnabled = true;
	v17.UpperAngle = 135;
	v17.LowerAngle = 0;
	v17.Restitution = 0;
	v17.Attachment0 = l__attachs__9.LeftUpperArm_LeftElbow;
	v17.Attachment1 = l__attachs__9.LeftLowerArm_LeftElbow;
	local v18 = l__Instance__2.new("BallSocketConstraint", v11);
	v10.RightWristConstraint = v18;
	v18.Name = "RightWristConstraint";
	v18.LimitsEnabled = true;
	v18.TwistLimitsEnabled = true;
	v18.UpperAngle = 30;
	v18.TwistLowerAngle = -45;
	v18.TwistUpperAngle = 45;
	v18.Attachment0 = l__attachs__9.RightLowerArm_RightWrist;
	v18.Attachment1 = l__attachs__9.RightHand_RightWrist;
	local v19 = l__Instance__2.new("BallSocketConstraint", v11);
	v10.LeftWristConstraint = v19;
	v19.Name = "LeftWristConstraint";
	v19.LimitsEnabled = true;
	v19.TwistLimitsEnabled = true;
	v19.UpperAngle = 30;
	v19.TwistLowerAngle = -45;
	v19.TwistUpperAngle = 45;
	v19.Attachment0 = l__attachs__9.LeftLowerArm_LeftWrist;
	v19.Attachment1 = l__attachs__9.LeftHand_LeftWrist;
	local v20 = l__Instance__2.new("BallSocketConstraint", v11);
	v10.RightHipConstraint = v20;
	v20.Name = "RightHipConstraint";
	v20.LimitsEnabled = true;
	v20.TwistLimitsEnabled = true;
	v20.UpperAngle = 50;
	v20.TwistLowerAngle = 100;
	v20.TwistUpperAngle = -45;
	v20.Attachment0 = l__attachs__9.LowerTorso_RightHip;
	v20.Attachment1 = l__attachs__9.RightUpperLeg_RightHip;
	local v21 = l__Instance__2.new("BallSocketConstraint", v11);
	v10.LeftHipConstraint = v21;
	v21.Name = "LeftHipConstraint";
	v21.LimitsEnabled = true;
	v21.TwistLimitsEnabled = true;
	v21.UpperAngle = 50;
	v21.TwistLowerAngle = 100;
	v21.TwistUpperAngle = -45;
	v21.Attachment0 = l__attachs__9.LowerTorso_LeftHip;
	v21.Attachment1 = l__attachs__9.LeftUpperLeg_LeftHip;
	local v22 = l__Instance__2.new("HingeConstraint", v11);
	v10.RightKneeConstraint = v22;
	v22.Name = "RightKneeConstraint";
	v22.LimitsEnabled = true;
	v22.UpperAngle = -140;
	v22.LowerAngle = 0;
	v22.UpperAngle = 0;
	v22.Attachment0 = l__attachs__9.RightUpperLeg_RightKnee;
	v22.Attachment1 = l__attachs__9.RightLowerLeg_RightKnee;
	local v23 = l__Instance__2.new("HingeConstraint", v11);
	v10.LeftKneeConstraint = v23;
	v23.Name = "LeftKneeConstraint";
	v23.LimitsEnabled = true;
	v23.UpperAngle = -140;
	v23.LowerAngle = 0;
	v23.UpperAngle = 0;
	v23.Attachment0 = l__attachs__9.LeftUpperLeg_LeftKnee;
	v23.Attachment1 = l__attachs__9.LeftLowerLeg_LeftKnee;
	local v24 = l__Instance__2.new("BallSocketConstraint", v11);
	v10.RightAnkleConstraint = v24;
	v24.Name = "RightAnkleConstraint";
	v24.LimitsEnabled = true;
	v24.TwistLimitsEnabled = true;
	v24.UpperAngle = 30;
	v24.TwistLowerAngle = -45;
	v24.TwistUpperAngle = 30;
	v24.Attachment0 = l__attachs__9.RightLowerLeg_RightAnkle;
	v24.Attachment1 = l__attachs__9.RightFoot_RightAnkle;
	local v25 = l__Instance__2.new("BallSocketConstraint", v11);
	v10.leftAnkleConstraint = v25;
	v25.Name = "leftAnkleConstraint";
	v25.LimitsEnabled = true;
	v25.TwistLimitsEnabled = true;
	v25.UpperAngle = 30;
	v25.TwistLowerAngle = -45;
	v25.TwistUpperAngle = 30;
	v25.Attachment0 = l__attachs__9.LeftLowerLeg_LeftAnkle;
	v25.Attachment1 = l__attachs__9.LeftFoot_LeftAnkle;
	for v26, v27 in l__pairs__3(v10) do
		v27.Enabled = false;
	end;
end;
function u1.GetParts(p5)
	local v28 = {};
	p5.parts = v28;
	local l__main_inst__29 = p5.parent.main_inst;
	v28.Head = l__CommonOHOH__1:GetPath("Head", l__main_inst__29);
	v28.UpperTorso = l__CommonOHOH__1:GetPath("UpperTorso", l__main_inst__29);
	v28.LowerTorso = l__CommonOHOH__1:GetPath("LowerTorso", l__main_inst__29);
	v28.RightUpperArm = l__CommonOHOH__1:GetPath("RightUpperArm", l__main_inst__29);
	v28.RightLowerArm = l__CommonOHOH__1:GetPath("RightLowerArm", l__main_inst__29);
	v28.LeftUpperArm = l__CommonOHOH__1:GetPath("LeftUpperArm", l__main_inst__29);
	v28.LeftLowerArm = l__CommonOHOH__1:GetPath("LeftLowerArm", l__main_inst__29);
	v28.RightHand = l__CommonOHOH__1:GetPath("RightHand", l__main_inst__29);
	v28.LeftHand = l__CommonOHOH__1:GetPath("LeftHand", l__main_inst__29);
	v28.RightUpperLeg = l__CommonOHOH__1:GetPath("RightUpperLeg", l__main_inst__29);
	v28.LeftUpperLeg = l__CommonOHOH__1:GetPath("LeftUpperLeg", l__main_inst__29);
	v28.RightLowerLeg = l__CommonOHOH__1:GetPath("RightLowerLeg", l__main_inst__29);
	v28.LeftLowerLeg = l__CommonOHOH__1:GetPath("LeftLowerLeg", l__main_inst__29);
	v28.RightFoot = l__CommonOHOH__1:GetPath("RightFoot", l__main_inst__29);
	v28.LeftFoot = l__CommonOHOH__1:GetPath("LeftFoot", l__main_inst__29);
	v28.HumanoidRootPart = l__CommonOHOH__1:GetPath("HumanoidRootPart", l__main_inst__29);
end;
local l__ipairs__4 = ipairs;
local u5 = { { "Head", "LeftUpperArm" }, { "Head", "LeftUpperLeg" }, { "Head", "LowerTorso" }, { "Head", "RightUpperArm" }, { "Head", "RightUpperLeg" }, { "Head", "UpperTorso" }, { "LeftFoot", "Lowertorso" }, { "LeftFoot", "UpperTorso" }, { "LeftFoot", "LeftLowerLeg" }, { "LeftFoot", "LeftUpderLeg" }, { "LeftHand", "LowerTorso" }, { "LeftLowerArm", "LowerTorso" }, { "LeftLowerArm", "UpperTorso" }, { "LeftLowerLeg", "LowerTorso" }, { "LeftLowerLeg", "UpperTorso" }, { "LeftUpperArm", "LeftUpperLeg" }, { "LeftUpperArm", "LowerTorso" }, { "LeftUpperArm", "RightUpperArm" }, { "LeftUpperArm", "RightUpperLeg" }, { "LeftUpperArm", "UpperTorso" }, { "LeftUpperLeg", "LowerTorso" }, { "LeftUpperLeg", "RightUpperLeg" }, { "LeftUpperLeg", "UpperTorso" }, { "RightFoot", "LowerTorso" }, { "RightFoot", "UpperTorso" }, { "RightFoot", "RightLowerLeg" }, { "RightFoot", "RightUpperLeg" }, { "RightHand", "UpperTorso" }, { "RightLowerArm", "UpperTorso" }, { "RightLowerArm", "LowerTorso" }, { "RightLowerLeg", "UpperTorso" }, { "RightLowerLeg", "LeftUpperArm" }, { "RightUpperArm", "LeftUpperLeg" }, { "RightUpperArm", "LowerTorso" }, { "RightUpperArm", "RightUpperLeg" }, { "RightUpperArm", "UpperTorso" }, { "RightUpperArm", "LeftUpperLeg" }, { "RightUpperLeg", "LowerTorso" }, { "RightUpperLeg", "UpperTorso" }, { "RightUpperLeg", "LeftUpperLeg" }, { "HumanoidRootPart", "Head" }, { "HumanoidRootPart", "LeftFoot" }, { "HumanoidRootPart", "LeftLowerArm" }, { "HumanoidRootPart", "LeftLowerLeg" }, { "HumanoidRootPart", "LeftUpperArm" }, { "HumanoidRootPart", "LeftUpperLeg" }, { "HumanoidRootPart", "RightFoot" }, { "HumanoidRootPart", "RightHand" }, { "HumanoidRootPart", "RightLowerArm" }, { "HumanoidRootPart", "RightLowerLeg" }, { "HumanoidRootPart", "RightUpperArm" }, { "HumanoidRootPart", "RightUpperLeg" }, { "HumanoidRootPart", "LowerTorso" }, { "HumanoidRootPart", "UpperTorso" }, { "HumanoidRootPart", "LeftHand" } };
local l__string__6 = string;
local l__table__7 = table;
function u1.CreateNoCollisions(p6)
	local l__parts__30 = p6.parts;
	local v31 = l__Instance__2.new("Folder", p6.parent.main_inst);
	v31.Name = "NoCollisions";
	p6.no_collision_folder = v31;
	local v32 = {};
	p6.no_collisions = v32;
	for v33, v34 in l__ipairs__4(u5) do
		local v35 = l__Instance__2.new("NoCollisionConstraint", v31);
		v35.Name = l__string__6.format("%s<->%s", l__table__7.unpack(v34));
		v35.Part0 = l__parts__30[v34[1]];
		v35.Part1 = l__parts__30[v34[2]];
		v35.Enabled = false;
		v32[v35.Name] = v35;
	end;
end;
local u8 = l__CommonOHOH__1.class.new(script, l__CommonOHOH__1.files.BaseComponent());
local l__Enum__9 = Enum;
local l__assert__10 = assert;
local u11 = {
	Died = true, 
	FallingDown = true, 
	FreeFalling = true, 
	Jumping = true, 
	PlatformStanding = true, 
	Ragdoll = true, 
	Seated = true, 
	Strafing = true
};
local l__tostring__12 = tostring;
local l__setmetatable__13 = setmetatable;
function u8.ctor(p7, p8)
	u8.super.ctor(p7, p8);
	p7.num = 1;
	p7.humanoid = p8:GetHumanoid_Loop();
	l__assert__10(p7.humanoid.RigType == l__Enum__9.HumanoidRigType.R15, "this model is not r15");
	p7.humanoid.RequiresNeck = false;
	p7.humanoid.BreakJointsOnDeath = false;
	u1.Init(p7);
	local v36 = {};
	local u14 = {};
	function v36.__index(p9, p10)
		return u14[p10];
	end;
	function v36.__newindex(p11, p12, p13)
		l__assert__10(u11[p12], "do not support state " .. l__tostring__12(p12));
		if p13 then
			u14[p12] = p7.humanoid[p12]:Connect(function(p14)
				if p14 == nil then
					p14 = true;
				end;
				p7:SetSwitch(p14);
			end);
			return;
		end;
		if u14[p12] then
			u14[p12]:Destroy();
			u14[p12] = nil;
		end;
	end;
	p7.links = l__setmetatable__13({}, v36);
end;
function u8.SetSwitch(p15, p16)
	p15.ragdollState = p16;
	for v37, v38 in l__pairs__3(p15.modelMotos) do
		if v38.Name ~= "Root" then
			v38.Enabled = not p16;
		end;
	end;
	for v39, v40 in l__pairs__3(p15.constraints) do
		v40.Enabled = p16;
	end;
	for v41, v42 in l__pairs__3(p15.parts) do
		v42.CanCollide = p16;
	end;
	for v43, v44 in l__pairs__3(p15.no_collisions) do
		v44.Enabled = p16;
	end;
end;
function u8.SetRagdoll(p17, p18)
	p17.num = p18;
	if p17.num == 1 then
		p17:SetSwitch(true);
		return;
	end;
	if p17.num ~= 2 then
		if p17.num == 3 then
			p17:SetSwitch(false);
		end;
		return;
	end;
	p17.humanoid:SetStateEnabled(l__Enum__9.HumanoidStateType.GettingUp, false);
	p17.humanoid:ChangeState(l__Enum__9.HumanoidStateType.Ragdoll);
	p17:SetSwitch(true);
end;
function u8.dtor(p19)
	if p19.no_collision_folder and p19.no_collision_folder.Parent then
		p19.no_collision_folder:Destroy();
	end;
	if p19.constraints_folder and p19.constraints_folder.Parent then
		p19.constraints_folder:Destroy();
	end;
	u8.super.dtor(p19);
end;
function u8.new(p20)
	return u8(p20);
end;
return u8;
